<?php
if (APPLICATION_ENV == 'production') {
    $files = array();
    foreach($this->JQuery()->getJavascriptFiles() as $k => $v) {
        if(preg_match('#custom_.*#', basename($v))) {
            $files[] = $v;
        }
    }
    $this->JQuery()->clearJavascriptFiles();
    foreach($files as $f) {
        $this->JQuery()->addJavascriptFile($f);
    }
    $this->JQuery()->addJavascriptFile(Ac_Util::getImageBaseUrl('/js/all.min.v-'.AC_VERSION.'.js'));
} else {
    $this->JQuery()->addJavascriptFile(Ac_Util::getImageBaseUrl('/js/tipsy/jquery.tipsy.v-'.AC_VERSION.'.js'));
    $this->JQuery()->addJavascriptFile(Ac_Util::getImageBaseUrl('/js/script.v-'.AC_VERSION.'.js'));
}

$grid_size = (boolean) (string) $this->placeholder('grid-size');
if (!$grid_size) {
    $grid_size = 16;
} else {
    $grid_size = (string) $this->placeholder('grid-size');
}

Zend_Registry::set('grid-size', $grid_size);

if (APPLICATION_ENV == 'production') {
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/all.v-'.AC_VERSION.'.css'));
} else {
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/custom.v-'.AC_VERSION.'.css'));
    $this->headLink()->appendStylesheet(Ac_Util::getImageBaseUrl('/css/tipsy/tipsy.v-'.AC_VERSION.'.css'));
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/theme/sunny.v-'.AC_VERSION.'.css'));
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/slideshow/nivo-slider.v-'.AC_VERSION.'.css'));
    //$this->headLink()->prependStylesheet('/css/sudoCss/Sudostyle.css?v='.AC_VERSION);
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/grid_'.$grid_size.'.v-'.AC_VERSION.'.css'));
    //$this->headLink()->prependStylesheet('/css/handheld.css');
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/style.v-'.AC_VERSION.'.css'));
    $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/reset.v-'.AC_VERSION.'.css'));
}
?><!doctype html>
<html lang="<?php echo Zend_Registry::get('translate')->getLocale()?>" class="no-js">
    <head>
        <meta charset="utf-8">
        <!--[if IE]><![endif]-->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <?php echo $this->headTitle()?>
        <meta name="author" content="AsiaClassified.com - Easy, Free, Local">
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=4.0;">
        <link rel="shortcut icon" href="/favicon.ico">
        <link rel="apple-touch-icon" href="/apple-touch-icon.png">
        <?php if (Zend_Registry::isRegistered('canonical')):?>
            <link rel="canonical" href="<?php echo 'http://'.$_SERVER['SERVER_NAME'].Zend_Registry::get('canonical');?>" />
        <?php endif;?>
        <meta name="Geography" content="Hong Kong">
        <meta name="city" content="Hong Kong">
        <meta name="State" content="Hong Kong">
        <meta name="country" content="Hong Kong">
        <meta name="geo.placename" content="Hong Kong">
        <meta name="geo.position" content="22.396428;114.109497">
        <meta name="ICBM" content="22.396428, 114.109497">
        <?php echo $this->headMeta() ?>
        <?php echo $this->headLink() ?>
        <?php echo $this->headStyle() ?>   
        <script src="<?php echo Ac_Util::getImageBaseUrl('/js/modernizr-1.5.min.js')?>"></script>
        <script type="text/javascript">
          var current_language = '<?php echo $this->current_language;?>';
        </script>        
        <!--script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script-->
    </head>
    <!--[if lt IE 7 ]> <body class="ie6 "> <![endif]-->
    <!--[if IE 7 ]>    <body class="ie7 "> <![endif]-->
    <!--[if IE 8 ]>    <body class="ie8 "> <![endif]-->
    <!--[if IE 9 ]>    <body class="ie9 "> <![endif]-->
    <!--[if gt IE 9]>  <body >             <![endif]-->
    <!--[if !IE]><!--> <body >         <!--<![endif]-->
        <?php if (empty($_COOKIE['ac_language_chosen'])):?>
            <section id="default_lang" class="default_lang">
		<h6><?php echo $this->t('Welcome! Please select your language:')?>
                    <a href="<?php echo $this->url_en?>"><em>English</em></a> 
                    <?php echo $this->t('or')?>  
                    <a href="<?php echo $this->url_tc?>"><em>????</em></a>
                </h6>
		<a href="#" class="close">Close</a>
            </section>
            <?php setcookie('ac_language_chosen', $this->current_language, time()+60*60*24*30*360,'/');?>
        <?php endif; ?>
        <div id="container" class="container container_<?php echo $grid_size?> <?php echo $this->placeholder('container-class');?> lang-<?php echo $this->current_language?>">
            <?php echo $this->Partial('index/header.phtml', 'default'); ?>
            <article <?php echo $this->placeholder('article-attributes')?> >
                <?php echo $this->placeholder('article-header');?>
                <section id="main_section" class="grid_<?php if ($grid_size == '12') {echo ($grid_size-4);} elseif ($grid_size == '16') {echo ($grid_size-3);}?> <?php echo $this->placeholder('big-section-class');?>">
                <!-- google_ad_section_start -->
                <?php echo $this->layout()->content; ?>
                <!-- google_ad_section_end -->
                </section>
                <?php
                    $class = (string) $this->placeholder('aside-class');
                    if (empty($class)) {
                        if($grid_size == '12') {
                            $class = 'grid_4';
                        } elseif ($grid_size == '16') {
                            $class = 'grid_3';
                        }
                    }
                ?>
                <aside class="aside <?php echo $class?>">
                    <?php echo $this->partial('index/header-part2.phtml', 'default');?>
                    <?php echo $this->placeholder('sidebar-right');?>
                </aside>
				 <?php echo $this->placeholder('after-aside');?>
            </article>
            <?php echo $this->placeholder('fullwidth-content');?>
            <section class="footer_ad">
                <?php echo $this->partial('index/commercial-zone3.phtml','default');?>    
            </section>
            <footer class="footer grid_<?php echo $grid_size?>">
                <?php echo $this->Partial('index/footer.phtml', 'default'); ?>
            </footer>
        </div><!--! end of #container -->
        <!--[if lt IE 7 ]>
            <script src="/js/dd_belatedpng.js?v=1"></script>
          <![endif]-->
        <?php echo $this->headScript() ?>
        <?php echo $this->JQuery() ?>
        <?php if (defined('GOOGLE_ANALYTICS')): ?>
            <!-- asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
                 change the UA-XXXXX-X to be your site's ID -->
            <script>
                /*
                var _gaq = [['_setAccount', '<?php echo GOOGLE_ANALYTICS ?>'], ['_trackPageview']];
                (function(d, t) {
                    var g = d.createElement(t),
                    s = d.getElementsByTagName(t)[0];
                    g.async = true;
                    g.src = '//www.google-analytics.com/ga.js';
                    s.parentNode.insertBefore(g, s);
                })(document, 'script');
                */
                var _gaq = _gaq || [];
                  _gaq.push(['_setAccount', '<?php echo GOOGLE_ANALYTICS ?>']);
                  _gaq.push(['_setDomainName', '.asiaclassified.com']);
                  _gaq.push(['_trackPageview']);
                  _gaq.push(['_trackPageLoadTime']);                  

                  (function() {
                    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
                  })();
            </script>
            <!-- Quantcast Tag -->
            <script type="text/javascript">
            var _qevents = _qevents || [];

            (function() {
            var elem = document.createElement('script');
            elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
            elem.async = true;
            elem.type = "text/javascript";
            var scpt = document.getElementsByTagName('script')[0];
            scpt.parentNode.insertBefore(elem, scpt);
            })();

            _qevents.push({
            qacct:"p-91qUc-oi2FSjY"
            });
            </script>

            <noscript>
            <div style="display:none;">
            <img src="//pixel.quantserve.com/pixel/p-91qUc-oi2FSjY.gif" border="0" height="1" width="1" alt="Quantcast"/>
            </div>
            </noscript>
            <!-- End Quantcast tag -->
            <!-- compete -->
            <script type="text/javascript">
                __compete_code = '748adce6fe39a0c4b090cc48bc816514';
                (function () {
                    var s = document.createElement('script'),
                        e = document.getElementsByTagName('script')[0],
                        t = document.location.protocol.toLowerCase() === 'https:' ?
                            'https://c.compete.com/bootstrap/' :
                            'http://c.compete.com/bootstrap/';
                        s.src = t + __compete_code + '/bootstrap.js';
                        s.type = 'text/javascript';
                        s.async = true;
                        if (e) { e.parentNode.insertBefore(s, e); }
                    }());
            </script>
           
            <!-- baidu -->
            <script type="text/javascript">
            var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
            document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F42a5c610df68d7436cfc42dad97d6c5f' type='text/javascript'%3E%3C/script%3E"));
            </script>

        <?php endif; ?>
        <?php echo $this->placeholder('at-the-bottom');?>
        <img src="<?php echo Ac_Util::getImageBaseUrl('/images/default_image_ac.jpg')?>" style="display:none">
    </body>
</html>
